package com.yanqu.road.server.cmd.activity.dragonboatrace;

import com.yanqu.road.pb.dragonboatrace.DragonBoatRaceProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.dragonboatrace.DragonBoatRaceMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @Description
 * @Author cwq
 * @Data 2022/2/15 17:31
 */
@Cmd(code = CrossProtocol.C2_DRAGONBOATRACE_RECEIVE_UNION_REWARD, desc = "赛龙舟领取联盟奖励")
public class CrossDragonBoatRaceReceiveUnionRewardCmd extends CrossCommand {

    int activityId ;
    long userId ;
    String unionId;
    int placeId;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        DragonBoatRaceProto.DragonBoatRaceReceiveRecordRewardGameToCrossMsg builder = DragonBoatRaceProto.DragonBoatRaceReceiveRecordRewardGameToCrossMsg.parseFrom(packet.getBytes());
        activityId = builder.getActivityId();
        userId = packet.getPlayerId();
        unionId = builder.getUnionId();
        placeId = builder.getPlaceId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId, YanQuMessageUtils.buildMessage(GameProtocol.S_DRAGONBOATRACE_RECEIVE_UNION_REWARD_FROM_CROSS, DragonBoatRaceMgr.receiveRecord(activityId,unionId,userId,placeId)));
    }

    @Override
    public void sendData() {

    }
}
